package com.atguigu.guli.service.cms.controller.api;



import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.cms.entity.Ad;
import com.atguigu.guli.service.cms.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


/**
 * <p>
 * 广告推荐 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2021-11-09
 */
@RestController

@RequestMapping("/api/cms/ad")
public class ApiAdController {
@Autowired
    AdService adService;
    //查询首页热门数据，展示在广告位置
    //1、banner图 图片封面。图片的链接地址，图片的序号，图片的背景颜色
    //2、热门课程信息
    //3、热门讲师信息
    @Cacheable(value = "ad",key = "'banners'")
  @GetMapping("getBanner")
public R getAdList(){
      List<Ad> adlist = adService.list();
      return R.ok().data("items",adlist);

}





}

